package com.heima.juc.n4;

import com.heima.juc.n2.Sleeper;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * @author : leimingchao
 * @date Date : 2022年02月11日 16:24
 */
@Slf4j(topic = "c.TestParkUnPark")
class TestParkUnPark {

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.debug("start.....");
            Sleeper.sleep(1);
            log.debug("park");
            LockSupport.park();
            log.debug("resume");
        },"t1");

        t1.start();

        Sleeper.sleep(2);

        log.debug("unpark");

        LockSupport.unpark(t1);
    }
}
